import { useEffect, useState } from "react";
import { useSearchParams } from "react-router-dom";
import request from "../../axios/request";
import { useDispatch } from "react-redux";
import { cunshuju } from "../../store/xiangqingslick/xiangqingslick";
import styles from './index.module.css'
import { VerticalAlignTopOutlined } from "@ant-design/icons";
function Index() {
  const fuwuyuan = useDispatch();
  const [sp] = useSearchParams();
  const [shuju, setshuju] = useState({});
  const id = sp.get("id");
  const diaoyong = async () => {
    await request.get(`/article/${id}`).then((res) => {
      if (res.status == 200) {
        setshuju(res.data);
        console.log(res.data);
        fuwuyuan(cunshuju(res.data));
      }
    });
  };
  useEffect(() => {
    diaoyong();
  }, [sp]);
  return (
    <div className={styles.dabox}>
      <div>详情页面的时间{shuju?.updatedAt}</div>
      <div>详情页面的浏览量{shuju?.viewCount}</div>
      <div>详情页面的内容{shuju?.content}</div>
      <div className={styles.tubiao}><VerticalAlignTopOutlined style={{color:'green'}} /></div>
    </div>
  );
}

export default Index;
